package com.atguigu.springcloud;

import com.atguigu.myrule.MySelfRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;

/**
 * @Author: robert.song
 * @Date: Created in 2021/7/21
 */
@SpringBootApplication
@EnableEurekaClient
//为特定服务指定负载规则，负载规则 "MySelfRule" 不能被component扫描，否则会变成全局规则，因此要用@RibbonClient标记这个包外的Rule
@RibbonClient(name="CLOUD-PAYMENT-SERVICE",configuration = MySelfRule.class)
//或
@RibbonClients(value = {@RibbonClient(name="CLOUD-PAYMENT-SERVICE",configuration = MySelfRule.class)})
/**
 * 或另外也可以使用配置文件指定负载规则
 * CLOUD-PAYMENT-SERVICE: # 设置的服务提供方的 应用名称
 *   ribbon:
 *     NFloadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule # 策略类(全路径名)
 */
public class OrderMain80 {
    public static void main(String[] args) {
        SpringApplication.run(OrderMain80.class,args);
    }
}
